#include<iostream>
using namespace std;
bool a(int x)
{
	int ans = 0;
	int t = x;
	while (t) {
		ans = ans * 10 + t % 10;
		t /= 10;
	}
	if (ans == x) {
		return 1;
	}
	return 0;
}
int main()
{
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		if (a(i)) {
			cout << i << endl;
		}
	}
	
	return 0;
}